home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / comm / fido / shelter191a.lha / rexx / WFREQIT.wplrx < prev    next >
Text File  |  1994-03-11  |  39KB  |  1,150 lines

  1. /**/ 
  2. v="$VER: FREQIT Wplrx  Multi-BBS Freq Forwarder   Williamson/Mollitt 52.20"
  3. /*  Based on FREQIT.rx Door for XenoLink By: Sean Mollitt (1:167/165.0) */
  4. configpath  = "CFG:freqit/freqit.cfg"
  5.  
  6. options results
  7. signal on failure
  8. signal on syntax
  9.  
  10. CALL PRAGMA('Stack',20000)
  11. sv='v'||right(v,4)
  12. script="Wfreqit"
  13. wplport=bitor(GetClip('SHELTER'),'20'x))
  14.  
  15. /*--------------------------------- */
  16.     quote='"'
  17.     cr="\r\n"
  18.     bs='08'x
  19.     CLS='H'
  20.  
  21.     Blk = '';Red = ''
  22.     Grn = '';Yel = ''
  23.     Blu = '';Pur = ''
  24.     Cya = '';Wht = ''
  25.     Off = ''
  26.     BluYel = '' ; CyaWht = ''
  27.     CyaBlu = '' ; BluCya = ''
  28.     BluWht = '' ; BluPur = ''
  29.     CyaPur = '' ; GrnYel = ''
  30.     RedYel = ''
  31.  
  32.     thing="AMM"
  33.     thing37="ADM"
  34.     thing48="ADM"
  35.  
  36.     prompt0=Pur"["Cya"X"Pur"] to Skip Text, ["Cya"Return"Pur"] to continue or ["Cya"Q"Pur"]uit browsing > "Wht
  37.     prompt1=Pur"["Cya"M"Pur"]ark ["Cya"Return"Pur"] to continue or ["Cya"Q"Pur"]uit browsing > "Wht
  38.     prompt2=Pur"["Cya"M"Pur"]ark ["Cya"S"Pur"]earch ["Cya"X"Pur"] to skip text ["Cya"Return"Pur"] to continue or ["Cya"Q"Pur"]uit browsing > "Wht
  39.     prompt3=Pur"["Cya"Return"Pur"] to continue or ["Cya"Q"Pur"]uit browsing "Wht
  40.  
  41.     /* standrd WPLRX interface, wbaud and wline not used in THIS script */
  42.     parse arg wbaud wline wusername
  43.  
  44.     local=0
  45.     if upper(strip(wbaud)) = "SYSOP" then do
  46.         wusername="SYSOP LOCAL"
  47.         wline=0 ; local=1 ; wbaud='9600' ; cr='0a'x
  48.         close('STDOUT')
  49.         call open('STDOUT','CON:0/10/665/230/'script sv'/CLOSE','w')
  50.         call close('STDIN')
  51.         call open('STDIN','*','R')
  52.     end
  53.  
  54.     call send(CLS)
  55.     call send(Pur"  "script sv" (Multi-BBS File Request Forwarder)"||cr)
  56.     call send(Pur"  Original XenoLink version 1.1"Cya" by Sean Mollitt      "Blu" FidoNet#1:167/165"||cr)
  57.     call send(Pur"  WPL.library version          "Cya" by Robert Williamson "Blu" FidoNet#1:167/104"||cr)
  58.     call send(Wht"  Loading config file...")
  59.  
  60.     /* List of "INTERPRETed" functions */
  61.  
  62.     checkbytes = "IF DATATYPE(STRIP(WORD(line.a,2),'T','k'),'N')=1 THEN check=check+1"
  63.     checkdate  = "IF POS('-',WORD(line.a,3),3)= 3 & POS('-',RIGHT(WORD(line.a,3),3),1)= 1 then check=check+1"
  64.     checkdot   = "IF POS('.',RIGHT(WORD(line.a,1),5))~=0 then check=check+1"
  65.     checkday   = "IF POS(UPPER(LEFT(WORD(line.a,3),3)),'MON TUE WED THU FRI SAT SUN YES TOD')~=0 then check=check+1"
  66.     checkkb    = "IF RIGHT(WORD(line.a,2),1)='k' & DATATYPE(STRIP(WORD(line.a,2),'T','k'))='NUM' then check = check+1"
  67.     checkbkdot = "IF DATATYPE(STRIP(WORD(line.a,2),'T','k'))='NUM' & POS('.',RIGHT(WORD(line.a,1),5))~=0 then check=check+1"
  68.  
  69.     if ~OPEN('config',configpath,'R') then do
  70.         call send("Error! Cannot find the config file:"configpath||cr)
  71.         signal shutdown
  72.     end
  73.  
  74.     
  75.     u=0;x=0;z=0;stringn=""
  76.  
  77. readconfigline:
  78.  
  79.     cfgln = TRANSLATE(READLN('config'),' ','09'x)     /* strips tabs out of config */
  80.     if LEFT(STRIP(cfgln),1) ~= ';' & COMPRESS(cfgln) ~= "" then do
  81.         x=x+1
  82.         if STRIP(WORD(cfgln,1))='BBSLIST' then do
  83.             z=z+1
  84.             bbsname.z  = STRIP(TRANSLATE(READLN('config'),' ','09'x))
  85.             offset= POS(';',bbsname.z)-1
  86.             if offset > 0 then bbsname.z = STRIP(LEFT(bbsname.z,offset)) 
  87.             filelist.z = WORD(STRIP(TRANSLATE(READLN('config'),' ','09'x)),1)
  88.             node.z     = WORD(STRIP(TRANSLATE(READLN('config'),' ','09'x)),1)
  89.             time.z     = WORD(STRIP(TRANSLATE(READLN('config'),' ','09'x)),1)
  90.             type.z     = WORD(STRIP(TRANSLATE(READLN('config'),' ','09'x)),1)
  91.             access.z   = WORD(STRIP(TRANSLATE(READLN('config'),' ','09'x)),1)
  92.             signal readconfigline
  93.         end 
  94.         if STRIP(WORD(cfgln,1))='USERLEVEL' then do
  95.             u=u+1
  96.             user.u=upper(STRIP(TRANSLATE(READLN('config'),' ','09'x)))
  97.             userpriv.u=subword(user.u,words(user.u))
  98.             signal readconfigline
  99.         end
  100.  
  101.         cfg.x = STRIP(STRIP(WORD(cfgln,2)),'B','"')
  102.     end
  103.     if ~EOF('config') then signal readconfigline
  104.  
  105.     filedir = cfg.1
  106.     indir   = cfg.2
  107.     maxreq  = cfg.3
  108.     maxk    = cfg.4
  109.     maxover = cfg.5
  110.     callout = cfg.6
  111.     outnode = cfg.7
  112.     txtfile = cfg.8
  113.     hlpfile = cfg.9
  114.     usrfile = cfg.10
  115.     logfile = cfg.11
  116.     msgtxt  = cfg.12
  117.     msgarea = cfg.13
  118.     netarea = cgf.14
  119.     maxdays = cfg.15
  120.     outbound = cfg.16
  121.     pollcmd = cfg.17
  122.     hostaddr = cfg.18
  123.     userfs  = cfg.19
  124.     loggroup = cfg.20
  125.  
  126.     CALL CLOSE('config')
  127.     users=u
  128.  
  129.     if wusername = "" then do
  130.         usrname=upper(strip(wprompt(120,cr||'  Enter name: ')))
  131.         if usrname="" then signal shutdown
  132.     end
  133.     else usrname=upper(strip(wusername))
  134.  
  135.     fixuser=translate(usrname,"_"," ")
  136.  
  137.     call sendmsg
  138.     
  139.     if local then do
  140.         priv=100 ; known = 1
  141.     end;else do
  142.         priv=20 ; known=0
  143.         do u=1 to users
  144.             if index(user.u,usrname) ~= 0 then do
  145.                 priv=userpriv.u
  146.                 known=1
  147.             end
  148.         end
  149.     end
  150.     if ~known then call send(cr||'  User 'usrname', your access level is 'priv||cr)
  151.     else call send(cr||'  User 'usrname', your special access level is 'priv||cr)
  152.     x=wprompt(120,Wht"  [Return] to continue ")
  153.  
  154. /**/
  155.     rows=24
  156. /**/
  157.  
  158.  
  159.     if priv >= maxover then do
  160.         maxk    = 9000000
  161.         maxreq  = 100
  162.     end
  163.  
  164.     call send(Wht"AM  Loading user file...level:"priv""||CR)
  165.     if ~exists(usrfile) then Address COMMAND 'echo >'usrfile
  166.  
  167.     if ~OPEN('user',usrfile,'R') then do
  168.         call send("Error! Cannot find the user file (freqit.usr) "usrfile||cr)
  169.         signal shutdown
  170.     end
  171.  
  172.     totwaitk=0;e=0;up=0;m=0;totk=0;totusers=0;opts = ""
  173.  
  174. readuserfile:    
  175.     usrline = UPPER(READLN('user'))
  176.     if EOF('user') then signal printwait
  177.     m=m+1 ; i=0 ; files.m=0
  178.     name.m= usrline
  179.     totusers = m
  180.     if name.m = UPPER(usrname) then up = m
  181.     do FOREVER
  182.         i=i+1
  183.         usrline = READLN('user')
  184.         if WORD(usrline,1)= "#" then BREAK
  185.         PARSE VAR usrline file.m.i filek.m.i filed.m.i filea.m.i filestat.m.i fileto.m.i filedes.m.i
  186.         files.m = i
  187.     end
  188.     
  189.     if ~EOF('user') then signal readuserfile
  190.  
  191. printwait:
  192.  
  193.     CALL CLOSE('user')
  194.  
  195.     if up ~= 0 then do
  196.         call send(CLS||cr)
  197.         call send(Pur"  The following file(s) already on request:"||cr)
  198.         call send(Blu"  -----------------------------------------"||cr)
  199.         do i= 1 to files.up           
  200.             if filestat.up.i = 'waiting' then call send(Wht"  "LEFT(file.up.i,24)||"          "||RIGHT(filek.up.i,7)||cr)
  201.             totk=totk+filek.up.i
  202.         end
  203.         x=wprompt(120,Wht"  [Return] to continue ")
  204.         call send(Pur"  The following file(s) have been received:"||cr)
  205.         call send(Blu"  -----------------------------------------"||cr)
  206.         tosend=""
  207.         do i= 1 to files.up
  208.             if filestat.up.i ~= 'waiting' then do
  209.                 call send(Wht"  "LEFT(file.up.i,24)||"          "||RIGHT(filek.up.i,7)||cr)
  210.                 tosend=tosend||" "||file.up.i
  211.             end
  212.         end
  213.         x=wprompt(120,Wht"  [Return] to continue ")
  214.  
  215.         usermsg=msgarea||fixuser
  216.         if exists(usermsg) then do
  217.             call display_text(usermsg)
  218.             resp=upper(wprompt(120,cr||'Do you wish to download these files now? [y/n]'))
  219.             if resp="Y" then do
  220.                 call sendfiles(tosend)
  221.                 call delete(usermsg)
  222.                 do i= 1 to files.up
  223.                     filestat.up.i = 'REMOVED'
  224.                 end
  225.                 signal saveuserfile
  226.             end
  227.         end    
  228.  
  229.         maxk = maxk - totk
  230.         maxreq = maxreq - files.up
  231.  
  232.         if maxreq <= 0 then do
  233.             call send(Blu"  -----------------------------------------"||cr)
  234.             call send(Red"  You cannot request any more files until"||cr) 
  235.             call send("  these "files.up" have been processed and received"||cr) 
  236.             call send(Blu"  -----------------------------------------"||cr)
  237.             x=wprompt(120,Wht"  [Return] to continue ")
  238.             signal shutdown 
  239.         end
  240.  
  241.         call send(Blu"  -----------------------------------------"||cr)
  242.         call send(Pur"  You may request "Cya||maxreq||Pur" more file(s)"Cya "("||(TRUNC(maxk/1000))||"k)"Wht||cr)
  243.         call send(Blu"  -----------------------------------------"||cr)
  244.         x=wprompt(120,Wht"  [Return] to continue ")
  245.         signal Mainmenu
  246.     end 
  247.  
  248. nofileswaiting:
  249.  
  250.     up = m+1          /* up= user position in user file */
  251.     files.up = 0
  252.     name.up  = UPPER(usrname)
  253.     totusers= totusers + 1
  254.  
  255. Mainmenu:
  256.     stringn=""
  257.     wfiles.up = files.up
  258.     nodeaddr="";opts=" "
  259.  
  260.     call send("H")
  261.     call send(Cya"    FILE REQUEST BBS CATALOGUES  "||cr)
  262.     call send(Blu"  -------------------------------"||cr)
  263.     call send(Pur"  The maximum number of files you"||cr)
  264.     SELECT
  265.         WHEN priv >= maxover then call send(Pur"  can request is: "Cya"unlimited"||cr)
  266.         WHEN maxreq < = 0 then    call send(Pur"  can request is: "Cya"none"||cr)
  267.         OTHERWISE                 call send(Pur"  can request is: "Cya||maxreq||"  ("||(TRUNC(maxk/1000))||"k max)"||cr) 
  268.     end
  269.     call send(Blu"  -------------------------------"||cr)
  270.     call send(Blu"  System         Support Platform"||cr)
  271.     do i = 1 to z
  272.         if access.i <= priv then call send(Cya"  ["||i||"] "pur||bbsname.i||cr)
  273.         stringn=stringn||i
  274.     end
  275.     stringn=stringn||'QHS'
  276.  
  277.     call send(Blu"  -------------------------------"||cr)
  278.     call send(pur"  "Cya"[S]"pur" Search  "Cya"[H]"pur" Help  "Cya"[Q]"pur" Quit"||cr)
  279.     if priv >= maxover then do
  280.         call send(cr)
  281.         call send(pur"  "Cya"   Sysop Commands"||cr)
  282.         call send(Blu"  "Cya"   --------------"||cr)
  283.         call send(pur"  "Cya"   [M]"pur" Freq manager"||cr)
  284.         call send(pur"  "Cya"   [L]"pur" View freq log"||cr)
  285.         call send(pur"  "Cya"   [N]"pur" Freq new list"||cr)
  286.         stringn=stringn||'MNL'
  287.     end
  288.     cmd=UPPER(wprompt(120,Cya"  Select"Wht" > "))
  289.  
  290.     if cmd="" | POS(cmd,stringn)=0 then signal mainmenu
  291.  
  292.     if cmd="Q" then signal Shutdown
  293.  
  294.     if datatype(cmd,'N') & POS(cmd,stringn) ~=0 THEN do
  295.         call send("  retrieving file list...")
  296.         fullpath = filedir||filelist.cmd
  297.         signal openfile
  298.     end
  299.  
  300.     if cmd="H" then do 
  301.         call display_text(hlpfile)
  302.         x=wprompt(120,"[Return] to continue")
  303.         signal mainmenu
  304.     end
  305.  
  306.     if cmd="S" then do
  307.         opts = ""
  308.         cmd=upper(wprompt(120,Cya"AM  Search which file list #: "Wht))
  309.         if cmd="" then signal mainmenu
  310.         if POS(cmd,stringn)=0 then 
  311.         do
  312.             x=wprompt(120,Yel"AM  Enter the NUMBER of the file list to search [Return]"Wht)
  313.             signal Mainmenu
  314.         end
  315.         fullpath = filedir||filelist.cmd
  316.         result=wprompt(120,Cya"AM  Search string: "Wht)
  317.         if result="" then signal mainmenu
  318.  
  319.         srch= WORD(STRIP(result,'B','*'),1)
  320.         if UPPER(srch)="Q" THEN signal mainmenu
  321.         if UPPER(srch)=" " THEN signal mainmenu
  322.         call send(Pur"AM  Searching file list. "Cya"[Q]"pur" to abort"Wht)
  323.         cmdline = " run search >ram:t/found "fullpath" "srch" NONUM"
  324.         wait=0
  325.         address command cmdline
  326.         options failat 20
  327.  
  328.         do forever
  329.             call send(".")
  330.             if checkabort() then
  331.             do
  332.                 call send("AM  aborted! Showing matches..."||CR)
  333.                 address command "status >ram:t/proc COMMAND = search"
  334.                 address command "Break <ram:t/proc >nil: ?"
  335.                 call delete("ram:t/proc")
  336.                 LEAVE
  337.             end
  338.  
  339.             wait = wait + 1
  340.             if wait == 5 then do
  341.                 call send("D")
  342.                 wait = 1
  343.             end
  344.             address command 'Status COMMAND = search'
  345.             if RC = 5 then break
  346.         end
  347.         call delay(40)
  348.         fullpath = "ram:t/found"
  349.         OPTS = "S"
  350.         call send(CR)
  351.         signal openfile
  352.     end
  353.  
  354.     if cmd="L" then do
  355.         call display_text(logfile)
  356.         call send("------------------------------------------------------------------------------- "||CR)
  357.         x=wprompt(120,"[Return] to continue")
  358.         signal mainmenu
  359.     end
  360.  
  361.     if cmd="N" then do
  362.         cmd=upper(wprompt(120,Cya"AM  [#]"pur" of bbs to freq 'FILES' from or "Cya"[N]"pur"ew: "Wht))
  363.         if cmd="" then signal mainmenu
  364.         if POS(cmd,stringn||"N")=0 then do
  365.             x=wprompt(120,Yel"AM  Enter the NUMBER of the BBS to Freq [Return]"Wht)
  366.             signal Mainmenu
  367.         end
  368.         if cmd="N" then do
  369.             result=wprompt(120,Cya"AM  Node address to freq 'FILES' from : "Wht)
  370.             nodeaddr = UPPER(result)
  371.             if nodeaddr = "" then signal mainmenu
  372.             if DATATYPE(COMPRESS(nodeaddr,':/.')) ~= 'NUM' then do
  373.                 x=wprompt(120,Yel"AM  Not a valid node address! [Return]"Wht)
  374.                 signal Mainmenu
  375.             end
  376.         end
  377.         freqlist=upper(wprompt(120,Cya"AM  [Return] to freq 'FILES' or enter NEW name : "Wht))
  378.         if freqlist = "" then freqlist="FILES"
  379.         signal freqit
  380.     end
  381.  
  382.     if cmd="M" then do
  383.         if files.1 = 0 THEN do
  384.             x=wprompt(120,Pur"AM  Waiting freq list is empty!"Cya" [Return]")
  385.             signal mainmenu
  386.         end
  387.  
  388.         k=0;l=2;v=0
  389.         call send(CLS)
  390.         call send(Pur"##   User/File name        bytes   date out     node       date in  destination "Wht||cr)
  391.         call send(Blu"--------------------------------------------------------------------------------"Wht||cr)
  392.  
  393.         do i= 1 to totusers
  394.             l=l+1
  395.             call send( Pur||"     "||LEFT(name.i,20)||CR)
  396.             do j = 1 to files.i
  397.                 k=k+1 ; l=l+1
  398.  
  399.                 if POS('_',fileto.i.j) ~= 0 then ffileto.i.j = LEFT(fileto.i.j,1)||'.'||SUBSTR(fileto.i.j,POS('_',fileto.i.j)+1)
  400.                     ELSE ffileto.i.j = fileto.i.j
  401.  
  402.                 call send(Cya||LEFT("["||k||"]",4)||" "||Wht||LEFT(file.i.j,20)||" "||RIGHT(filek.i.j,7)||"  "||filed.i.j||"  "||LEFT(filea.i.j,11)||"  "RIGHT(filestat.i.j,8)"  "LEFT(ffileto.i.j,11)||cr)
  403.                 ffile.k = file.i.j ; ffilea.k = filea.i.j ; ffileto.k = fileto.i.j
  404.                 if l >= (rows-3) | j = files.i THEN do
  405.                     char=upper(wprompt(120,Cya"[R]"Pur"emove "Cya"[F]"Pur"req "Cya"[P]"pur"urge "Cya"[D]"pur"estination "Cya"[Q]"Pur"uit "Cya"[Return]"Pur" > "Wht))
  406.                     if char = "Q" & v=0 then signal mainmenu
  407.                     if char = "Q" & v~=0 then signal saveuserfile
  408.                     if char = "R" then do
  409.                         marks=0
  410.                         marks=wprompt(120,"AM"Cya"Remove file request #'s : "Wht)
  411.                         call send(thing)
  412.                         numb = words(marks)
  413.                         call send("Removing "numb" file request(s)."||CR)
  414.                         if numb=0 | DATATYPE(VALUE(COMPRESS(marks))) ~= 'NUM' then signal mainmenu
  415.                         v=0;r=0
  416.                         do q = 1 to numb
  417.                             fnum = WORD(marks,q)
  418.                             if fnum > k then signal mainmenu
  419.                             y=0
  420.                             do r= 1 to totusers
  421.                                 do s= 1 to files.r
  422.                                     y=y+1
  423.                                     if y = fnum then do
  424.                                         v=v+1; kfiles.r = v
  425.                                         file.r.s = "REMOVED"
  426.                                         if kfiles.r = files.r then name.r="REMOVED"    
  427.                                         /* call send("Removing user :"name.r||CR) */
  428.                                     end
  429.                                 end
  430.                             end
  431.                         end
  432.                         call send(thing)
  433.                     end
  434.  
  435.                     if char = "P" then do
  436.                         marks=0
  437.                         marks=upper(wprompt(120,"AM"Cya"Purge all files that have been received from the list? [y/N] "Wht))
  438.                         if marks ~= 'Y' then signal mainmenu
  439.                         v=0;r=0; y=0
  440.                         do r= 1 to totusers
  441.                             do s= 1 to files.r
  442.                                 y=y+1
  443.                                 if filestat.r.s ~= 'waiting' then do
  444.                                     v=v+1; kfiles.r = v
  445.                                     file.r.s = "REMOVED"
  446.                                     if kfiles.r = files.r then name.r="REMOVED"    
  447.                                     /* call send("Removing user :"name.r||CR) */
  448.                                 end
  449.                             end
  450.                         end
  451.                         call send(thing)
  452.                     end
  453.     
  454.                     if char = "F" then do
  455.                         marks=0
  456.                         marks=wprompt(120,"AM"Cya"Freq file #'s : "Wht)
  457.                         call send(thing)
  458.                         numb = words(marks)
  459.                         call send("Freqing "numb" file(s)."||CR)
  460.                         if numb=0 | DATATYPE(VALUE(COMPRESS(marks))) ~= 'NUM' then signal mainmenu
  461.                         do q = 1 to numb
  462.                             fnum = WORD(marks,q)
  463.                             if fnum > k then signal mainmenu
  464.                             
  465.                             call makereq(ffilea.fnum,ffile.fnum)
  466.                             call send(".")
  467.                         end
  468.                         call send(thing)
  469.                     end
  470.     
  471.                     if char = "D" then do
  472.                         marks=0;destin=""
  473.                         fmark=wprompt(120,"AM"Cya"Change Destination of what file # : "Wht)
  474.                         if DATATYPE(fmark) ~= 'NUM' then BREAK
  475.                         numb = words(marks)
  476.                         if numb >1 | DATATYPE(VALUE(COMPRESS(marks))) ~= 'NUM' then signal mainmenu
  477.                         call send(thing37)
  478.                         marks=upper(wprompt(120,Cya"[U]"pur"ser "Cya"[O]"Pur"ther user "Cya"[N]"pur"ode or "Cya"[F]"pur"ile section > "Wht))
  479.                         if marks='U' then destin = "USER"
  480.     
  481.                         if marks='O' then do
  482.                             call send(thing48)
  483.                             destin=UPPER(TRANSLATE(wprompt(120,Cya"User name to send file # ["fmark"] to : "Wht),'_',' '))
  484.                         end
  485.                         if marks='F' then do
  486.                             call send(thing1)
  487.                             destin=wprompt(120,Cya"Section number to send file # ["fmark"] to : "Wht)
  488.                         end
  489.                         if marks='N' then do
  490.                             call send(thing48)
  491.                             destin=wprompt(120,Cya"Node address to forward file # ["fmark"] to : "Wht)
  492.                             if POS(':',destin) = 0 | DATATYPE(COMPRESS(destin,':/.')) ~= 'NUM' then do
  493.                                 x=wprompt(120,Yel"AM  Not a valid node address! [Return]"Wht)
  494.                                 signal Mainmenu
  495.                             end
  496.                         end
  497.                         if destin="" then BREAK
  498.                         v=0;r=0; y=0
  499.                         do r= 1 to totusers
  500.                             do s= 1 to files.r
  501.                                 y=y+1
  502.                                 if y = fmark then do
  503.                                     if filestat.r.s ~= 'waiting' then 
  504.                                     do
  505.                                         x=wprompt(120,"AM"pur"Only "cya"waiting"pur" files can be edited!")
  506.                                     end;else do
  507.                                         fileto.r.s = destin
  508.                                         v=v+1
  509.                                     end
  510.                                 end
  511.                             end
  512.                             if v~=0 then break
  513.                         end
  514.                         call send(thing)
  515.                     end
  516.                     call send(thing)
  517.                     l=0
  518.                 end 
  519.             end
  520.             l=l+1
  521.         end
  522.         call send(Blu"AM--------------------------------------------------------------------------------"Wht||cr)
  523.         x=wprompt(120,Pur"end of list."Cya" [Return] "Wht)
  524.         if v ~=0 then signal saveuserfile
  525.     end
  526.     signal mainmenu
  527. openfile:
  528.  
  529.     r=0;a=0;b=0;c=0;d=0;kbt=0;totnk=0;deslen=0
  530.  
  531.     gototype   = "signal "||type.cmd
  532.     if type.cmd = "NBDI" then deslen=39
  533.     if type.cmd = "NKDI" then deslen=43
  534.     if type.cmd = "NBI"  then deslen=45
  535.  
  536.     if ~OPEN('input',fullpath,'R') then do
  537.         call send("Error. Cannot open "fullpath||CR)
  538.         signal shutdown
  539.     end
  540.     call send(CLS)
  541.  
  542. /* 
  543.    a= # of current line
  544.    b= # valid file name
  545.    c= # lines scrolled
  546.    d= # marked files
  547.    e= # of waiting files 
  548. */
  549.  
  550.     nextlinepos=0
  551.     check=0 ;
  552.  
  553.     firstlines:
  554.  
  555.     if opts ~= "S" THEN do
  556.         a=a+1;c=c+1
  557.         if c = rows-3 THEN do
  558.             marks=wprompt(120,prompt0)
  559.             if marks="" then marks="C"
  560.             if UPPER(marks)="Q" then signal alldone
  561.             if UPPER(marks)=' ' | UPPER(marks)="X"  then do
  562.                 i=0; 
  563.                 call send("AM")
  564.                 do UNTIL COMPRESS(STRIP(READLN('input'),'T','0D'x))="" | i=300 
  565.                     i=i+1
  566.                     if EOF('input') | checkabort() then BREAK
  567.  
  568.                     call send("M"||"skipping "||LEFT(i,4)||"D")
  569.                 end
  570.                 i=0 ; BREAK
  571.             end
  572.  
  573.             call send("AAMM")
  574.             c=0
  575.         end 
  576.         line.a = STRIP(READLN('input'),'T','0D'x)
  577.  
  578.         if type.cmd = "NBI" THEN  INTERPRET checkbkdot
  579.             ELSE INTERPRET checkdate
  580.  
  581.         if check = 0 THEN call send(line.a||CR)
  582.             ELSE signal findtype
  583.  
  584.         signal firstlines
  585.     end
  586.  
  587. startloop:
  588.  
  589.     a=a+1 ; check=0 ; pref= ""
  590.         
  591.     line.a = STRIP(READLN('input'),'T','0D'x)
  592.     if opts = "S" then signal findtype
  593.  
  594.     if COMPRESS(LEFT(line.a,25))="" & nextlinepos ~=0 then do 
  595.         r=r+1
  596.         PARSE VAR line.a ldes.b.r
  597.         line.a = ""||nextlinepos||"C"||LEFT(STRIP(ldes.b.r),deslen)  /* much faster this way */
  598.         signal printit
  599.     end
  600.  
  601. findtype:
  602.     check=0
  603.     INTERPRET gototype
  604.  
  605.     NBDI:/* Name,Bytes,Date,Info */
  606.  
  607.     INTERPRET checkbytes 
  608.     if check~=0 then do
  609.         INTERPRET checkdate
  610.         if check=2 then signal NBDIdo
  611.         INTERPRET checkdot
  612.         if check=2 then signal NBDIdo
  613.         INTERPRET checkday
  614.         if check < 2 THEN nextlinepos=0
  615.     end
  616.     signal printit
  617.  
  618. NBDIdo:
  619.     b=b+1 ; r=1
  620.     PARSE VAR line.a lname.b lsize.b ldate.b ldes.b.r
  621.     ldes.b.r=STRIP(ldes.b.r)
  622.     pref   = Cya||LEFT("["||b||"]",6)||Wht
  623.     line.a = LEFT(lname.b,16)||" "||RIGHT(lsize.b,7)||" "||LEFT(ldate.b,9)||" "||LEFT(ldes.b.r,38)
  624.     nextlinepos = WORDINDEX(line.a,4)+5
  625.   signal printit
  626.  
  627. NKDI:       /* Name,Kilobytes,Date,Info */
  628.  
  629.     INTERPRET checkkb
  630.     INTERPRET checkdate
  631.     if check=2 then signal NKDIdo
  632.     INTERPRET checkdot
  633.     if check=2 then signal NKDIdo
  634.     INTERPRET checkday
  635.     if check < 2 THEN nextlinepos=0
  636.   signal printit
  637.  
  638. NKDIdo:
  639.     b=b+1 ; r=1
  640.     PARSE VAR line.a lname.b lsize.b ldate.b ldes.b.r
  641.     ldes.b.r=STRIP(ldes.b.r)
  642.     pref = Cya||LEFT("["||b||"]",6)||Wht
  643.     line.a = LEFT(lname.b,14)||" "||RIGHT(lsize.b,5)||" "||LEFT(ldate.b,9)||" "||LEFT(ldes.b.r,deslen)
  644.     lsize.b = VALUE(STRIP(lsize.b,'T','k'))*1000
  645.     nextlinepos = WORDINDEX(line.a,4)+5
  646.   signal printit
  647.  
  648. NBI:    /* Name,Bytes,Info */
  649.  
  650.     INTERPRET checkbkdot
  651.     if check = 1 THEN signal NBIdo
  652.     nextlinepos=0
  653.   signal printit
  654.  
  655. NBIdo:
  656.     b=b+1 ; r=1
  657.     PARSE VAR line.a lname.b lsize.b ldes.b.r
  658.     ldes.b.r=STRIP(ldes.b.r)
  659.     pref = Cya||LEFT("["||b||"]",6)||Wht
  660.     line.a = LEFT(lname.b,14)||"  "||RIGHT(lsize.b,5)||"  "||LEFT(ldes.b.r,deslen)
  661.     nextlinepos = WORDINDEX(line.a,3)+5
  662.   signal printit
  663.  
  664. printit:
  665.     if opts ~= "S" | (opts = "S" & pref ~="") THEN do
  666.         c=c+1 
  667.         call send(pref||line.a||CR)
  668.         signal markit
  669.     end 
  670.  
  671. markit:
  672. /*    if checkabort() then signal alldone   */
  673.     
  674.     if c < rows-3 & ~EOF('input') then signal startloop
  675.     if c = rows-3 |  EOF('input') then do
  676.         c=0
  677.         SELECT
  678.             WHEN opts ="S" THEN x=prompt1 
  679.             WHEN b ~= 0  THEN x=prompt2
  680.             WHEN b  = 0  THEN x=prompt3
  681.         end
  682.         marks = wprompt(120,x)
  683.  
  684.         if marks="" then marks="C"
  685.  
  686.         call send(cr)
  687.  
  688.         if UPPER(marks)='Q' then signal alldone
  689.  
  690.         if UPPER(marks)='S' then do
  691.             parsetype   = "signal "||type.cmd||"do"
  692.             marks=wprompt(120,Cya"AMEnter search string: "Wht)
  693.             if marks="" then BREAK
  694.             i=0
  695.             call send("AM")
  696.             sline = STRIP(READLN('input'),'T','0D'x)
  697.             do WHILE POS(marks,sline)=0 | COMPRESS(LEFT(sline,25)) = ""
  698.                 sline = STRIP(READLN('input'),'T','0D'x)
  699.               /* len = LENGTH(sline) */
  700.                 i=i+1;if EOF('input') then BREAK
  701.                 call send("M"||"searching "||LEFT(i,4)||"D")
  702.             end
  703.             i=0 ; line.a = sline ; INTERPRET parsetype
  704.         end
  705.  
  706.         if UPPER(marks)=' ' | UPPER(marks)="X" then do
  707.             i=0
  708.             call send("AM")
  709.             do UNTIL COMPRESS(STRIP(READLN('input'),'T','0D'x))="" | i=300 
  710.                  i=i+1;if EOF('input') then BREAK
  711.                  call send("M"||"skipping "||LEFT(i,4)||"D")
  712.             end
  713.             i=0 ; BREAK
  714.         end
  715.  
  716.         if UPPER(marks)='M' then do
  717.             marks=wprompt(120,Cya"AMMark file numbers: "Wht)
  718.             numb=words(marks)
  719.             if numb=0 then BREAK
  720.             if DATATYPE(COMPRESS(marks))~='NUM' then do
  721.                 x=wprompt(120,"AMFile *NUMBERS* only! [Return]")
  722.                 marks=wprompt(120,Cya"AMMark file numbers: "Wht)
  723.                 numb=words(marks)
  724.                 if numb=0 then BREAK
  725.             end
  726.  
  727.             do i=1 to numb
  728.                 if WORD(marks,i) > b THEN do
  729.                     x=wprompt(120,"AMNumber out of range! [Return]")
  730.                     marks=wprompt(120,Cya"AMMark file numbers: "Wht)
  731.                     numb=words(marks)
  732.                     if numb=0 then BREAK
  733.                 end
  734.             end
  735.  
  736.             do i=1 to numb
  737.                 d=d+1
  738.                 filenumb = WORD(marks,i)
  739.                /*     call send(lname.filenumb||' added') */
  740.                /*    if totk + lsize.filenumb > maxk then signal maxkreached */
  741.                 if lsize.filenumb > maxk then signal maxkreached
  742.                 if d > maxreq then signal maxfreached
  743.                 files.up   = files.up + 1 
  744.                 u = files.up
  745.                 file.up.u  = lname.filenumb
  746.                 filek.up.u = lsize.filenumb
  747.                 filed.up.u = DATE('E')
  748.                 filea.up.u = node.cmd
  749.                 filestat.up.u = 'waiting'
  750.                 fileto.up.u = 'USER'
  751.                 filedes.up.u = "" ; j=1
  752.                 do WHILE SYMBOL(ldes.filenumb.j) ~= 'LIT'
  753.                     filedes.up.u = filedes.up.u||' '||STRIP(ldes.filenumb.j)
  754.                     j=j+1
  755.                     if j=100 then break
  756.                 end
  757.  
  758.                 if POS('[',WORD(filedes.up.u,1))~=0 THEN filedes.up.u = STRIP(DELWORD(filedes.up.u,1,1))
  759.                 j=0
  760.                 totk = totk + lsize.filenumb
  761.                 totnk = totnk + lsize.filenumb
  762.             end
  763.             if UPPER(cs) = 'N' THEN signal alldone
  764.         end
  765.         call send("AMAM")
  766.     end
  767.  
  768.     if ~EOF('input') THEN signal startloop
  769.     call wprompt(120,Pur"end of file list! [Return]"Wht)
  770.     call send(CLS)
  771.     signal alldone
  772.  
  773. maxkreached:
  774.     call wprompt(120,Yel"Maximum bytes exeeded! [Return] to continue"Wht)
  775.     d=d-1
  776.     /* files.up = files.up - 1*/
  777.      /* call send("max allowed: "maxk */
  778.     call send("total bytes: "totk||cr)
  779.     call send("last file  : "lsize.filenumb||cr)
  780.     call wprompt(120,"")
  781.     signal alldone
  782.  
  783. maxfreached:
  784.     call wprompt(120,Yel"Maximum number of files reached! [Return] to continue"Wht)
  785.     d=d-1
  786.     /*files.up = files.up - 1 */
  787.  
  788. /* 
  789.        a= # of current line
  790.        b= # valid file name
  791.        c= # lines scrolled
  792.        d= # marked files
  793.        e= # of waiting files 
  794. */
  795.  
  796. alldone:
  797.     call CLOSE('input')
  798.     if d = 0 then signal mainmenu 
  799.     call send(CLS)
  800.  
  801.     i = wfiles.up + 1
  802.  
  803.     freqlist=" "
  804.     call send(Pur"  You have Requested the following "||d||" file(s)"Wht||cr)
  805.     call send(Blu"  --------------------------------------------------"Wht||cr)
  806.     do a=i to files.up
  807.         freqlist=freqlist||file.up.a||" "
  808.         call send("  "||LEFT(file.up.a,30)||"            "||RIGHT(filek.up.a,7)||cr)
  809.     end
  810.     call send(Blu"  --------------------------------------------------"||cr)
  811.     call send(Pur"  Total bytes:                             "RIGHT(totnk,8)||cr)
  812.     call send(Blu"  --------------------------------------------------"||cr)
  813.     if wusername="SYSOP LOCAL" then do
  814.         answer=upper(wprompt(120,Cya"  Are you sure you want to freq these files?"Pur" [Y/n] "Wht))
  815.         if answer ="N" then signal mainmenu
  816.     end;else do
  817.         answer=upper(wprompt(120,Cya"  Are you sure you want to freq these files?"Pur" [y/N] "Wht))
  818.         if answer ~="Y" then signal mainmenu
  819.     end
  820.     maxk   = maxk - totnk
  821.     maxreq = maxreq - d
  822.  
  823. freqit:
  824.     if Nodeaddr="" then Nodeaddr = node.cmd
  825.     call makereq(Nodeaddr,freqlist)
  826.  
  827.     if Nodeaddr=hostaddr then do
  828.         call localfreq
  829.         signal mainmenu
  830.     end;else if PRIV >= callout then do 
  831.         if wusername="SYSOP LOCAL" then do
  832.             cmdline='Execute 'pollcmd Nodeaddr
  833.             address COMMAND cmdline
  834.             call send(Pur"  OK... "||yel||pollcmd Nodeaddr||pur||" queued." Wht)
  835.         end;else do    
  836.             answer=upper(wprompt(120,Pur||cr||"  Would you like the bbs to call out and do the"||cr||" file request as soon as a line is free?"Cya" [y/N] "Wht))
  837.             if answer  ="Y" then do
  838.                 cmdline='Execute 'pollcmd Nodeaddr
  839.                 address COMMAND cmdline
  840.                 x=wprompt(120,Pur"  OK... "||yel||pollcmd Nodeaddr||pur||" queued. [Return]" Wht)
  841.             end
  842.         end
  843.         if freqlist="FILES" then signal mainmenu
  844.         call send(CLS)
  845.     end
  846.  
  847. donetext:
  848.     call display_text(txtfile)
  849.  
  850. saveuserfile:
  851.     call send(Cya"  Saving data..."||CR)
  852.  
  853.     if ~OPEN('userw',usrfile,'W') then do
  854.         call send("Error! Cannot open user file ("||usrfile||")"||cr)
  855.         signal shutdown
  856.     end
  857.  
  858.     o=0;p=0;q=0;r=0
  859.  
  860.     do o = 1 to totusers
  861.         if name.o ~= "REMOVED" THEN CALL WRITELN('userw',name.o)
  862.         do p = 1 to files.o
  863.             filedat= LEFT(file.o.p,20)||"  "||RIGHT(filek.o.p,7)||"  "||filed.o.p||"  "||filea.o.p||"  "||LEFT(filestat.o.p,8)||" "||fileto.o.p||" "||filedes.o.p
  864.             if file.o.p ~= "REMOVED" THEN CALL WRITELN('userw',filedat)
  865.         end
  866.         if name.o ~= "REMOVED" THEN CALL WRITELN('userw','#')
  867.     end
  868.  
  869.     CALL CLOSE('userw')
  870.  
  871. rereaduserfile:
  872.     if ~OPEN('user',usrfile,'R') then do
  873.         call send("Error! Cannot find the user file (freqit.usr) "usrfile||CR)
  874.         signal shutdown
  875.     end
  876.  
  877.     totwaitk=0;e=0;up=0;m=0;totk=0;totusers=0;opts = "";files.1=0
  878.  
  879.     do WHILE ~EOF('user')
  880.         usrline = UPPER(READLN('user'))
  881.         if EOF('user') then BREAK
  882.         m=m+1 ; i=0 ; files.m=0
  883.         name.m= usrline
  884.         totusers = m
  885.         if name.m = UPPER(usrname) then up = m
  886.         do FOREVER
  887.             i=i+1
  888.             usrline = READLN('user')
  889.             if WORD(usrline,1)= "#" then BREAK
  890.             PARSE VAR usrline file.m.i filek.m.i filed.m.i filea.m.i filestat.m.i fileto.m.i filedes.m.i
  891.             files.m = i
  892.         end
  893.     end
  894.  
  895.     CALL CLOSE('user')
  896.  
  897.     if up=0 then do
  898.         up = m+1
  899.         files.up = 0
  900.         name.up  = UPPER(usrname)
  901.         totusers= totusers + 1
  902.     end
  903.  
  904.     call wprompt(120," OK  [Return]"Pur" to continue ")
  905.     signal mainmenu
  906.  
  907. Shutdown:
  908.     call send(CLS)
  909.     EXIT
  910.  
  911. /* wpl interface */
  912. makereq: procedure expose outbound reqname
  913.     a=arg(1)
  914.     reqs=arg(2)
  915.     parse var a z ':' n '/' f '.' p
  916.     reqname=upper(outbound||z'.'n'.'f'.'p||".REQ")
  917.     if ~Open('reqfile',reqname,'A') then do
  918.         if ~Open('reqfile',reqname,'W') then do
  919.             say "Error opening" reqname
  920.             call cleanup
  921.             Exit 1  
  922.         end
  923.     end 
  924.     do fi=1 to words(reqs)
  925.         call WriteLN('reqfile',strip(word(reqs,fi))||'0d'x) 
  926.     end
  927.     call Close('reqfile')
  928.     address COMMAND 'FileNote' reqname address
  929. return
  930.  
  931. checkabort:
  932.     ctlc=winput(1)
  933.     if UPPER(ctlc) = "Q" | ctlc = '03'x then return 1
  934. return 0
  935.  
  936. display_text: procedure expose rows CLS bs cr quote local
  937.     textfile=arg(1)
  938.     call send(CLS)
  939.     if ~open('tf',textfile,"R") then do
  940.         call Send(cr||'Sorry, unable to find 'textfile||cr)
  941.         return 0
  942.     end
  943.     call send(cr)
  944.     lines=0
  945.     do while ~eof('tf')
  946.         if ~local then do
  947.             'CheckCarrier'
  948.             if RC~=0 then do
  949.                 call close('tf')
  950.                 call cleanup
  951.                 exit
  952.             end
  953.         end
  954.  
  955. /*        if checkabort() then return   */
  956.         call send(readln('tf')||cr)
  957.         lines=lines+1
  958.         if lines=rows then do
  959.             lines=0
  960.             resp=wprompt(60,cr||'More(Y,n): ')
  961.             if upper(resp) = "N" then 
  962.             do
  963.                 call close('tf')
  964.                 call send(cr)
  965.                 return 0
  966.             end;else do
  967.                 call send(copies(bs,12))
  968.             end
  969.         end
  970.     end    
  971.     call close('tf')
  972.     call send(cr)
  973. return 0
  974.  
  975.  
  976. sendmsg:
  977.     mfile='LOG:RFSacct/'fixname||'.0.0.0.0.m'
  978.     if exists(mfile) then do
  979.         call send(cr||" The sysop left this personal message for you, "word(fname,1)||cr)
  980.         call open('am',mfile,'R')
  981.         do while ~eof('am')
  982.             line=readln('am')
  983.             y=pos(cr,line)
  984.             if y ~= 0 then call send(line'\n')
  985.                 else call send(line||cr)
  986.         end
  987.         call close('am')
  988.     end
  989. return
  990.  
  991.  
  992. localfreq:
  993.     if local then return 0
  994.     call send(cr||' Please WAIT, searching local bases for requested files')
  995.     address=fixuser||"#0:0/0.0"
  996.     call putlog("WfreqIt session with "address)
  997.     'Set remote.address' address
  998.     'SetA remote $(remote.address)'
  999.     'Set remote.network FIDO'
  1000.     'BeginSession $(remote.address)'
  1001.  
  1002.     call send(cr||' You have a few seconds to MAKE SURE Zmodem is your')
  1003.     call send(cr||' default protocol and AutoDownLoad and ADL Challenge is ON'||cr)
  1004.  
  1005.     if userfs="TRUE" then address "REXX" 'Ram:rexx/RFS.rexx' wplport wline wbaud 'WFREQIT#'hostaddr reqname 0 address usrname
  1006.     else Address COMMAND 'XfreqSH CFG:freq.cfg RAM:freq.lst' req reqname address
  1007.  
  1008.     call send(cr||' Ready! '||cr)
  1009.     'CheckCarrier'
  1010.     if RC~=0 then do
  1011.         call putlog(usrname 'dropped carrier during search')
  1012.         call cleanup
  1013.         exit
  1014.     end
  1015.     'Set req TRUE fsend TRUE protocol ZMODEM'
  1016.     'SetMailerFlags "DN,PN"'
  1017.     'XprSetup xprzedzap.library TN,ON,B8,F0,E30,AN,DN,KN,SN,RN,NN,M1024'
  1018.     'SetUpDate "CON:0/$($(line).w_offset)/640/130/Wfreqit $(protocol) $(remote.address)/AUTO/SCREEN$(pscreen)"'
  1019.     'XprSend ""'
  1020.     'XprClose'
  1021.     'SetUpDate NULL'
  1022.     'EndSession all'
  1023. return
  1024.  
  1025. sendfiles:
  1026.     if local then return 0
  1027.     freqs=arg(1)
  1028.     call putlog("FREQIT Send")
  1029.     call send(' Please make sure that Zmodem is your default protocol and'||cr)
  1030.     call send(' that Autodownload and ADL Challenge are turned on.'||cr)
  1031.     address=fixuser||"#0:0/0.0"
  1032.     'Set protocol ZMODEM fsend TRUE remote.address 'address
  1033.     'XprSetup xprzedzap.library "TN,ON,B8,F0,E30,AN,DN,KN,SY,RN,M1024"'
  1034.     'SetUpDate "CON:0/60/640/$($(line).w_offset)/$(protocol) Freqit Server/AUTO/SCREEN$(pscreen)"'
  1035.     do i=1 to words(freqs)
  1036.         'XprSetFile' indir||word(freqs,i) word(freqs,i) 'O'
  1037.         call send(' Sending' indir||word(freqs,i) 'as 'word(freqs,i)||cr)
  1038.     end
  1039.     do i=1 to words(freqs)
  1040.         'XprSend' word(freqs,i)    
  1041.     end
  1042.     'XprClose'
  1043.     'SetUpDate NULL'
  1044. return 0
  1045.  
  1046.  
  1047. /*
  1048. break_c:
  1049. break_d:
  1050.     call cleanup
  1051.     exit 10
  1052.  
  1053. novalue: 
  1054.         call template_oops "Novalue" sigl
  1055. syntax:
  1056.         call template_oops "Syntax(RC=" || RC || ")" sigl rc
  1057. failure:
  1058.         call template_oops "Failure(RC=" || RC || ")" sigl
  1059. ioerr:
  1060.         call template_oops "IOErr" sigl 
  1061. halt:
  1062.         call template_oops "Halt" sigl 
  1063.  
  1064. template_oops:
  1065.         parse arg what badline code
  1066.         call send(cr||'ERROR: Line:'badline what 'please inform sysop'||cr)
  1067.         if code ~= "" then call putlog("FREQIT: Error Line "badline what errortext(code))
  1068.             else call putlog("FREQIT: Error Line "badline what)
  1069.         call cleanup
  1070.         exit(40)
  1071. */
  1072. /**/
  1073.  
  1074.  
  1075. syntax:
  1076.     call send(cr||"SYNTAX ERROR LINE:" SIGL)
  1077.     call send(cr||"Please inform the sysop")
  1078.     call wprompt(120," [Return] ")
  1079. EXIT
  1080.  
  1081. error:
  1082.     call send(cr||"RC CODE: "RC||CR)
  1083.     call send("ERROR LINE: "SIGL||CR)
  1084.     signal mainmenu
  1085.  
  1086. failure:
  1087.     call send(cr||"RC CODE: "RC||CR)
  1088.     call send("FAILURE LINE: "SIGL||CR)
  1089.     signal mainmenu
  1090.  
  1091.     if RC=5 THEN 
  1092.     do
  1093.         x=wprompt(120,Cya"AM  No matches found for "Yel||srch||Cya"  [Return]")
  1094.         signal mainmenu
  1095.     end
  1096.     call send(cr||"DOS COMMAND ERROR!, could not find something?"||CR)
  1097.     call send("Please inform the sysop."||CR)
  1098.     call send("RC CODE: "||RC||CR)
  1099.     EXIT
  1100.  
  1101. cleanup:
  1102. Return
  1103.  
  1104. send:
  1105.     if ~local then
  1106.     do
  1107.         'Print' quote||arg(1)||quote
  1108.         'Send' quote||arg(1)||quote   
  1109.     end
  1110.     else do
  1111.         if index(arg(1),'0a'x) = 0 then call writeln( 'STDOUT', arg(1) )
  1112.             else call writech( 'STDOUT', arg(1) ) 
  1113.     end
  1114. return
  1115.  
  1116. wprompt:
  1117.     if ~local then 
  1118.     do
  1119.         'Print' quote||arg(2)||quote
  1120.         'Send' quote||arg(2)||quote   
  1121.     end
  1122.     else options PROMPT arg(2)
  1123.  
  1124. winput:
  1125.     if local then 
  1126.     do 
  1127.         parse pull ustring
  1128.         return ustring
  1129.     end
  1130.     else do
  1131.         'GetInbound E0 'arg(1)    
  1132.         'String $(event)' 
  1133.         if upper(RESULT) = 'CARRIER' then     
  1134.         do    
  1135.             call putlog("Dropped Carrier")
  1136.             call cleanup  
  1137.             exit  
  1138.         end   
  1139.         else if upper(RESULT) = 'LOGIN' then  
  1140.         do    
  1141.             'String $(namebuf)'
  1142.             return (RESULT)    
  1143.         end   
  1144.         return ""
  1145.     end
  1146.  
  1147.  putlog:
  1148.     Address "LOGPROC" "Putlog "loggroup time() wline script arg(1)
  1149.  return
  1150.